<?php
require_once 'connexion (2).php';
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" href="feuilledestyle.css">
        <link rel="stylesheet" href="menuHead/jquery.cleditor.css">
        <link href="menu2/styles.css" rel="stylesheet" type="text/css">
    </head>
    <body vlink="blue">
        <div id="page">
        <?php include 'header.php';?>
        <div id="cadre">
            <?php include 'menu.php';?>
            <FORM style="float:left; margin-top: 20px; background-color: orange; "> <INPUT TYPE="button" VALUE="Retour" onClick="history.back()"> </FORM> 
            <div class="centre">
                <h3 style="margin-bottom: 124px;">Infos du stagiaire</h3>

                <?php
                $id1=null;
                if(!(isset($_GET["id"])))
                {
                    die("Parametre 'id' absent");
                }
                else
                {
                    $id1=$_GET["id"];
		}
                $req_rando="select * from personne where IDPERSONNE=".$id1;
                $resu_ra=$connexion->query($req_rando);
                if ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                {
                    $id=$rep["IDPERSONNE"];
                    $nomS=$rep["NOMPERSONNE"];
                    $preS=$rep["PRENOMPERSONNE"];
                    $tel=$rep["TELPERSONNE"];
                    $mail=$rep["MAILPERSONNE"];
                    echo '
                        <table id="tabinfoE"border="01" style="margin-left: auto; margin-right: auto; /*-moz-background-clip:*/ width:800px;">
                            <tr>
                                <th>Nom : </th>
                                <td style="max-width:245px;">'.$nomS.'</td>
                            </tr>
                            <tr>
                                <th>Prenom : </th>
                                <td style="max-width:245px;">'.$preS.'</td>
                            </tr>
                            <tr>
                                <th>Téléphone : </th>
                                <td style="max-width:245px;">'.$tel.'</td>
                            </tr>
                            <tr>
                                <th>E-Mail : </th>
                                <td style="max-width:245px;">'.$mail.'</a></td>
                            </tr>
                        </table>
                    ';
                }
                ?>
            </div>
            
            <div class="centre">
                <table border="1" align="center">
                    <tr style="margin-left: auto; margin-right: auto;">
                        <th>Récapitulatif</th>
                    </tr>
                </table>
                <?php
                $id1=NULL;
                if(!(isset($_GET["id"])))
                {
                    die("Parametre 'id' absent");
                }
                else
                {
                    $id1=$_GET["id"];
		}
                $req_rando="select * from stage s, entreprise e where IDELEVE=".$id1." and s.IDENTREPRISE=e.IDENTREPRISE";
                $resu_ra=$connexion->query($req_rando);
                while ($rep=$resu_ra->fetch(PDO::FETCH_ASSOC))
                {
                    $id=$rep["IDSTAGE"];
                    $etatS=$rep["ETATSTAGE"];
                    $sujetS=$rep["SUJETSTAGE"];
                    $dateDS=$rep["DATEDEBUT"];
                    $dateFS=$rep["DATEFIN"];
                    $nomEn=$rep["NOMENTREPRISE"];
                    $adrE=$rep["ADRESSEENTREPRISE"];
                    $telE=$rep["TELENTREPRISE"];
                    $web=$rep["SITE"];
                    $adrEweb=$rep["MAILENTREPRISE"];
                    
                    echo '
                        <table border="1" align="center">
                            <tr style="margin-left: auto; margin-right: auto;">
                                <th>Etat du Stage</th>
                                <th>Nom Entreprise</th>
                                <th>Date Début du Stage</th>
                                <th>Date Fin du Stage</th>
                            </tr>
                            <tr style="margin-left: auto; margin-right: auto;">
                                <td>'.$etatS.'</td>
                                <td>'.$nomEn.'</td>
                                <td>'.$dateDS.'</td>
                                <td>'.$dateFS.'</td>
                            </tr>
                            <tr style="margin-left: auto; margin-right: auto;">
                                <th>Adresse Entreprise</th>
                                <th>Téléphone Entreprise</th>
                                <th>Adresse Mail</th>
                                <th>Site Web</th>
                            </tr>
                            <tr style="margin-left: auto; margin-right: auto;">
                                <td>'.$adrE.'</td>
                                <td>'.$telE.'</td>
                                <td><a href= "'.$adrEweb.'" target="_block" >'.$adrEweb.'</a></td>
                                <td><a href= "'.$web.'" target="_block" >'.$web.'</a></td>
                            </tr>
                        </table><br/>';
                }
                ?>
            </div>
            <?php require_once 'pied.php';?> 
        </div>
        </div>
    </body>
</html>